// 对axios的二次封装
import request from '@/utils/request'

/**
 * 获取角色列表
 */
export function getRole(data) {
  return request({
    url: '/rights?_embed=children',
    method: 'get',
    data
  })
}
/**
 * 删除一级菜单列表
 */
export function delRole(data) {
  return request({
    url: '/rights/' + data.id,
    method: 'delete',
  })
}
/**
 * 删除二级菜单列表
 */
export function delRoleChild(data) {
  return request({
    url: '/children/' + data.id,
    method: 'delete',
  })
}
/**
 * 菜单开关一级
 */
export function patchRole(data) {
  return request({
    url: '/rights/' + data.id,
    method: 'patch',
    data: {
      pagepermisson: data.pagepermisson
    }
  })
}
/**
 * 菜单开关二级
 */
export function patchRoleChild(data) {
  return request({
    url: '/children/' + data.id,
    method: 'patch',
    data: {
      pagepermisson: data.pagepermisson
    }
  })
}